package com.crm.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the role database table.
 * 
 */
@Entity
@Table(name="role")
@NamedQuery(name="Role.findAll", query="SELECT r FROM Role r")
public class Role implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private String roleid;

	private String roledescribe;

	private String rolename;

	//bi-directional many-to-one association to Permissionallocation
	@OneToMany(mappedBy="role")
	private List<Permissionallocation> permissionallocations;

	//bi-directional many-to-one association to Role
	@ManyToOne
	@JoinColumn(name="pid")
	private Role role;

	//bi-directional many-to-one association to Role
	@OneToMany(mappedBy="role")
	private List<Role> roles;

	//bi-directional many-to-one association to Roleallocation
	@OneToMany(mappedBy="role")
	private List<Roleallocation> roleallocations;

	public Role() {
	}

	public String getRoleid() {
		return this.roleid;
	}

	public void setRoleid(String roleid) {
		this.roleid = roleid;
	}

	public String getRoledescribe() {
		return this.roledescribe;
	}

	public void setRoledescribe(String roledescribe) {
		this.roledescribe = roledescribe;
	}

	public String getRolename() {
		return this.rolename;
	}

	public void setRolename(String rolename) {
		this.rolename = rolename;
	}

	public List<Permissionallocation> getPermissionallocations() {
		return this.permissionallocations;
	}

	public void setPermissionallocations(List<Permissionallocation> permissionallocations) {
		this.permissionallocations = permissionallocations;
	}

	public Permissionallocation addPermissionallocation(Permissionallocation permissionallocation) {
		getPermissionallocations().add(permissionallocation);
		permissionallocation.setRole(this);

		return permissionallocation;
	}

	public Permissionallocation removePermissionallocation(Permissionallocation permissionallocation) {
		getPermissionallocations().remove(permissionallocation);
		permissionallocation.setRole(null);

		return permissionallocation;
	}

	public Role getRole() {
		return this.role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	public List<Role> getRoles() {
		return this.roles;
	}

	public void setRoles(List<Role> roles) {
		this.roles = roles;
	}

	public Role addRole(Role role) {
		getRoles().add(role);
		role.setRole(this);

		return role;
	}

	public Role removeRole(Role role) {
		getRoles().remove(role);
		role.setRole(null);

		return role;
	}

	public List<Roleallocation> getRoleallocations() {
		return this.roleallocations;
	}

	public void setRoleallocations(List<Roleallocation> roleallocations) {
		this.roleallocations = roleallocations;
	}

	public Roleallocation addRoleallocation(Roleallocation roleallocation) {
		getRoleallocations().add(roleallocation);
		roleallocation.setRole(this);

		return roleallocation;
	}

	public Roleallocation removeRoleallocation(Roleallocation roleallocation) {
		getRoleallocations().remove(roleallocation);
		roleallocation.setRole(null);

		return roleallocation;
	}

}